<?php

/**
 * Goods short summary.
 *
 * Goods description.
 *
 * @version 1.0
 * @author GALAXY
 */
class Goods extends Shop_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->Model('Goods_model');
        $this->load->Model('Goods_img_model');
        $this->load->Model('Goods_size_model');
        $this->load->Model('Goods_color_model');
    }

    public function details()
    {
       
        $goods_id=$this->uri->segment(3);
        $goodsmodel=$this->Goods_model->get_goods_by_id($goods_id);
        $data['goodsModel']=$goodsmodel;
        $data['goodsimgs']=$this->Goods_img_model->get_goods_img_by_goodsid($goods_id);
        $data['goodscolors']=$this->Goods_color_model->get_all_goods_color_by_goods_id($goods_id);
        $data['goodssizes']=$this->Goods_size_model->get_all_size_by_goods_size($goods_id);
        $data['hotgoods']=$this->Goods_model->get_hot_goods_();
       // p($this->GetConfigModel());
        $webconfig=$this->GetConfigModel();
        if(!empty($goodsmodel))
        {

            $goodstitle=$goodsmodel->title;
            $goodsseo_keyword=$goodsmodel->seo_keyword;
            $goodsseo_description=$goodsmodel->seo_description;
            if(!empty($goodstitle))
            {
                $webconfig->title=$goodstitle.'-'.$webconfig->title;
            }
            if(!empty($goodsseo_keyword))
            {
                $webconfig->keyword=$goodsseo_keyword.','.$webconfig->keyword;
            }
            if(!empty($goodsseo_description))
            {
                $webconfig->description=$goodsseo_description.','.$webconfig->description;
            }

        }
        $data['configModel']=$webconfig;

        $this->load->view('Pre/Goods/details.html',$data);
    }
}